import { IPSAppDEAction } from '../../app/dataentity/ipsapp-deaction';
import { IPSAppDataEntity } from '../../app/dataentity/ipsapp-data-entity';
import { IPSDEUIDEActionLogic } from './ipsdeuideaction-logic';
import { IPSDEUILogic } from './ipsdeuilogic';
import { IPSDEUILogicParam } from './ipsdeuilogic-param';
import { PSDEUILogicNodeImpl } from './psdeuilogic-node-impl';

export class PSDEUIDEActionLogicImpl extends PSDEUILogicNodeImpl implements IPSDEUIDEActionLogic {
  protected dstpsappdeaction: IPSAppDEAction | null = null;

  getDstPSAppDEAction(): IPSAppDEAction | null {
    if (this.dstpsappdeaction != null) return this.dstpsappdeaction;
    const value = this.M.getDstPSAppDEAction;
    if (value == null) {
      return null;
    }
    this.dstpsappdeaction = this.getDstPSAppDataEntityMust().findPSAppDEAction(value);
    return this.dstpsappdeaction;
  }

  get dstPSAppDEAction(): IPSAppDEAction | null {
    return this.getDstPSAppDEAction();
  }

  getDstPSAppDEActionMust(): IPSAppDEAction {
    const value = this.getDstPSAppDEAction();
    if (value == null) {
      throw new Error('未指定调用应用实体行为');
    }
    return value;
  }

  protected dstpsappdataentity: IPSAppDataEntity | null = null;

  getDstPSAppDataEntity(): IPSAppDataEntity | null {
    if (this.dstpsappdataentity != null) return this.dstpsappdataentity;
    const value = this.M.getDstPSAppDataEntity;
    if (value == null) {
      return null;
    }
    this.dstpsappdataentity = this.getPSModel4('app.dataentity.IPSAppDataEntity', value, 'getDstPSAppDataEntity') as IPSAppDataEntity;
    return this.dstpsappdataentity;
  }

  get dstPSAppDataEntity(): IPSAppDataEntity | null {
    return this.getDstPSAppDataEntity();
  }

  getDstPSAppDataEntityMust(): IPSAppDataEntity {
    const value = this.getDstPSAppDataEntity();
    if (value == null) {
      throw new Error('未指定目标应用实体对象');
    }
    return value;
  }

  protected dstpsdeuilogicparam: IPSDEUILogicParam | null = null;

  getDstPSDEUILogicParam(): IPSDEUILogicParam | null {
    if (this.dstpsdeuilogicparam != null) return this.dstpsdeuilogicparam;
    const value = this.M.getDstPSDEUILogicParam;
    if (value == null) {
      return null;
    }
    const ipsdeuilogic = this.getParentPSModelObject('dataentity.logic.IPSDEUILogic') as IPSDEUILogic;
    if (ipsdeuilogic != null) {
      this.dstpsdeuilogicparam = ipsdeuilogic.findPSDEUILogicParam(value);
    }
    return this.dstpsdeuilogicparam;
  }

  get dstPSDEUILogicParam(): IPSDEUILogicParam | null {
    return this.getDstPSDEUILogicParam();
  }

  getDstPSDEUILogicParamMust(): IPSDEUILogicParam {
    const value = this.getDstPSDEUILogicParam();
    if (value == null) {
      throw new Error('未指定目标逻辑参数对象');
    }
    return value;
  }

  protected retpsdeuilogicparam: IPSDEUILogicParam | null = null;

  getRetPSDEUILogicParam(): IPSDEUILogicParam | null {
    if (this.retpsdeuilogicparam != null) return this.retpsdeuilogicparam;
    const value = this.M.getRetPSDEUILogicParam;
    if (value == null) {
      return null;
    }
    const ipsdeuilogic = this.getParentPSModelObject('dataentity.logic.IPSDEUILogic') as IPSDEUILogic;
    if (ipsdeuilogic != null) {
      this.retpsdeuilogicparam = ipsdeuilogic.findPSDEUILogicParam(value);
    }
    return this.retpsdeuilogicparam;
  }

  get retPSDEUILogicParam(): IPSDEUILogicParam | null {
    return this.getRetPSDEUILogicParam();
  }

  getRetPSDEUILogicParamMust(): IPSDEUILogicParam {
    const value = this.getRetPSDEUILogicParam();
    if (value == null) {
      throw new Error('未指定返回值绑定逻辑参数对象');
    }
    return value;
  }

  get cls(): string {
    return 'PSDEUIDEActionLogicImpl';
  }

  instanceof(cls: string): boolean {
    if (cls == 'dataentity.logic.IPSDEUIDEActionLogic') return true;
    return super.instanceof(cls);
  }
}
